﻿using System;
using System.Windows.Forms;

namespace Storm.TextEditor.Editor.CodeCompletion
{
    /// <summary>
    /// Provides a base for all CompletionData information holder classes.
    /// </summary>
    public interface ICompletionData
    {
        /// <summary>
        /// Whether this type of completion data has a custom insertion action.
        /// </summary>
        bool CustomInsertionAction { get; }

        /// <summary>
        /// Gets or sets the index of the image.
        /// </summary>
        /// <value>The index of the image.</value>
        int ImageIndex { get; set; }

        /// <summary>
        /// Gets or sets the text.
        /// </summary>
        /// <value>The text.</value>
        string Text { get; set; }

        /// <summary>
        /// Gets or sets the description.
        /// </summary>
        /// <value>The description.</value>
        string Description { get; set; }

        /// <summary>
        /// Gets or sets the tag of this completion data.
        /// </summary>
        object Tag { get; set; }

        /// <summary>
        /// Provides the ability to have a completion data type with a custom insertion action.
        /// </summary>
        /// <param name="x">The x to insert at.</param>
        /// <param name="y">The y to insert at.</param>
        /// <param name="textEditor">The text editor in which this completion data resides.</param>
        void Insert(int x, int y, TextEditor textEditor);

        /// <summary>
        /// Provides the ability to have a completion data type that can decide when it wants to be completed.
        /// </summary>
        /// <param name="key">The key that the user has typed.</param>
        /// <returns>Whether the code completer should complete.</returns>
        bool ShouldInsert(char key);
    }
}
